<template>
  <a-dropdown class="app-helper-dropdown" @click="e => e.preventDefault()">
    <a-avatar class="avatar" src="https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png" />
    <template #overlay>
      <a-menu class="app-helper-more" @click="onHelperClick">
        <a-menu-item key="1">
          <router-link to="/">首页</router-link>
        </a-menu-item>
        <a-menu-item key="2">
          <a target="_blank" href="https://gitee.com/jikey/vue-tiger-admin">项目地址</a>
        </a-menu-item>
        <a-menu-divider />
        <a-menu-item key="3">退出</a-menu-item>
      </a-menu>
    </template>
  </a-dropdown>
</template>

<script lang="ts">
import { defineComponent } from 'vue'

export default defineComponent({
  setup() {
  },
  methods: {
    onHelperClick({ key }) {
      if (key === '3') {
        this.logout()
      }
    },
    logout() {
      this.$store.dispatch('user/logOut').then(() => {
        location.reload()
      })
    }
  }
})
</script>

<style>

</style>
